package com.huatai.datadevelop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huatai.datadevelop.entity.InterfaceTableConfigEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;

@Mapper
public interface InterfaceTableConfigMapper extends BaseMapper<InterfaceTableConfigEntity> {
    @Select("select * from (${sqlStr} ) AS B where ${sqlPJ} ${limitStr}")
    List<HashMap<String,Object>> getDataListInfoList(@Param("sqlStr") String sqlStr,@Param("sqlPJ")String sqlPJ,@Param("limitStr")String limitStr);

    /**
     * 根据表名获取数据总数
     * @param sqlStr
     * @return
     */
    @Select("select count(*) from ( ${sqlStr} ) AS T  where ${sqlPJ} ")
    Long getTableNameCount(@Param("sqlStr")String sqlStr, @Param("sqlPJ") String sqlPJ);
}
